<template>
    <div>
        新增权限
        <el-form ref="form" :model="form" label-width="80px">

            <el-form-item label="权限名">
                <el-input v-model="form.permissionName"></el-input>
            </el-form-item>

            <el-form-item label="描述信息">
                <el-input v-model="form.description"></el-input>
            </el-form-item>

            <el-form-item label="模块">
                <el-input v-model="form.module"></el-input>
            </el-form-item>

            <el-form-item label="方法">
                <el-input v-model="form.method"></el-input>
            </el-form-item>

            <el-form-item>
                <el-button type="primary" @click="onSubmit">立即创建</el-button>
                <router-link to="/home/permission">
                    <el-button> 取消</el-button>
                </router-link>
            </el-form-item>
        </el-form>
    </div>
</template>

<script>
import { addPermission } from '@/api/permission.js'

export default {
    data() {
        return {
            form: {
                permissionName: "",
                description: "",
                method: "",
                module: "",
            }
        }
    },
    methods: {
        onSubmit() {
            addPermission(this.form).then((result) => {
                this.$message.success('新增成功')
                this.$router.push('/home/permission')
            }).catch((err) => {

            });
        }
    }
}
</script>

<style>